package org.scboy.common.loads;

import java.util.List;

import org.apache.dubbo.config.annotation.DubboReference;
import org.scboy.coobi.sql.Coobi;
import org.scboy.coobi.sql.factory.EntityFactory;
import org.scboy.dbms.api.IInterManager;
import org.scboy.utils.caches.dbms.entity.InterEntity;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableCaching
@AutoConfigureAfter(value = {Coobi.class,EntityFactory.class})
public class LoadInterLang {

	@DubboReference
	IInterManager interManager;
	
	@Cacheable(value="DBMS_INTER_LANG",key="#appName+':'+#code+':'+#lang",unless="#result == null")
	public InterEntity getInter(String appName,String code,String lang) {
		return interManager.getInter(appName,code,lang);
	}
	
	public void init(List<InterEntity> datas){
		interManager.initInter(datas);
	}
}
